﻿<div class="container-fluid navbar-fixed-top top-bar">
    <div class="container-title">
        <div class="container-title-back" ng-click="back()"></div>
        <div class="container-title-main">备案点位置</div>
    </div>
</div>
<div class="clear50"></div>
<!--<div id="allmap">
</div>
<div class="container-fluid fixbottom">
    <button type="button" class="btn btn-default btn-block focus" ng-click="sub()">提 交</button>
</div>
<style type="text/css">
    body, html, #allmap {
        width: 100%;
        height: 100%;
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
    }
</style>
<script type="text/javascript">
    function init() {
        BdGpsApp.doBdGpsApp(function (gps) {
            gps = JSON.parse(gps)
            var point = new BMap.Point(gps.longitude, gps.latitude);
            window.localStorage.setItem("repointx", gps.longitude);
            window.localStorage.setItem("repointy", gps.latitude);
            var map = new BMap.Map("allmap");
            setTimeout(function () {
                var convertor = new BMap.Convertor();
                var pointArr = [];
                pointArr.push(point);
                convertor.translate(pointArr, 1, 5, translateCallback)
            }, 1000);
            translateCallback = function (data) {
                if (data.status === 0) {
                    var marker = new BMap.Marker(data.points[0]); // 创建标注
                    map.addOverlay(marker);// 将标注添加到地图中
                    window.localStorage.setItem("repointbaidux", data.points[0].lng);
                    window.localStorage.setItem("repointbaiduy", data.points[0].lat);
                    map.centerAndZoom(data.points[0], 17);
                    marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
                    map.enableScrollWheelZoom(true);//启用滚轮放大缩小
                }
            }
        });
    }
    $(function () {
        //百度地图API功能
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://api.map.baidu.com/api?v=2.0&ak=Hl4U00mw93xoS1kSDnqk8P6t&callback=init";
        document.body.appendChild(script);
    })
</script>-->
<div id="mapDiv"></div>
<style type="text/css">
    body, html, #mapDiv {
        width: 100%;
        height: 100%;
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
    }
</style>
<link rel="stylesheet" href="http://www.nbmap.gov.cn/leaflet/leaflet.css">
<script>

    document.addEventListener("deviceready", function () {
        BdGpsApp.doBdGpsApp(function (gps) {
            gps = JSON.parse(gps)
            window.localStorage.setItem("repointx", gps.longitude);
            window.localStorage.setItem("repointy", gps.latitude);
            //添加瓦片图层
            var layers = [];
            layers.push(new L.TileLayer.TDT.Vector());
            layers.push(new L.TileLayer.TDT.VectorAnno());
            map = new L.map('mapDiv', { layers: layers, attribution: false, zoomControl: false, crs: L.CRS.CustomLevel });
            var x1 = parseFloat(gps.longitude);
            var y1 = parseFloat(gps.latitude);
            map.setView([y1, x1], 17);
            //自定义marker
            var markericon = L.icon({ iconUrl: '../images/flickr.png', iconSize: [15, 15] });
            //定义标注并添加至地图
            L.marker([y1, x1]).addTo(map);
        });
    });
</script>